This is the same behaviour as gtk_widget_get_valign, except
we have no gtk_wiget_get_halign_with_baseline, as baselines make
no sense for halign.
Without this some widgets (like e.g. GtkOverlay) crash if you accidentally
set a BASELINE halign.
*
* Gets the value of the #GtkWidget:halign property.
*
+ * For backwards compatibility reasons this method will never return
+ * %GTK_ALIGN_BASELINE, but instead it will convert it to
+ * %GTK_ALIGN_FILL. Baselines are not supported for horizontal
+ * alignment.
+ *
* Returns: the horizontal alignment of @widget
*/
GtkAlign
gtk_widget_get_halign (GtkWidget *widget)
{
+ GtkAlign align;
+
g_return_val_if_fail (GTK_IS_WIDGET (widget), GTK_ALIGN_FILL);
- return _gtk_widget_get_aux_info_or_defaults (widget)->halign;
+
+ align = _gtk_widget_get_aux_info_or_defaults (widget)->halign;
+ if (align == GTK_ALIGN_BASELINE)
+ return GTK_ALIGN_FILL;
+ return align;
}
/**